package cn.itcast.service.cargo.impl;

import cn.itcast.dao.cargo.*;
import cn.itcast.domain.cargo.*;
import cn.itcast.service.cargo.PackingService;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.*;

// com.alibaba.dubbo.config.annotation.Service
@Service(timeout = 100000) 
public class PackingServiceImpl implements PackingService {


    @Autowired
    private PackingDao packingDao;

    @Override
    public Packing findById(String id) {
        return packingDao.selectByPrimaryKey(id);
    }

    @Override
    public void save(Packing packing) {
        packingDao.insertSelective(packing);
    }


    @Override
    public void delete(String id) {
        packingDao.deleteByPrimaryKey(id);
    }

    @Override
    public PageInfo<Packing> findByPage(PackingExample example, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Packing> list = packingDao.selectByExample(example);
        return new PageInfo<>(list);
    }


}














